import request from "@/utils/request"

// 查询所有的 todo
export const getTodoApi = (groupId: number) => request(`/todo/${groupId}`, 'get')

// 完成/取消完成 todo
export const doneApi = (data: number[]) => request('/todo/done', 'post', data)

// 标记为重要/不重要 todo
export const starApi = (data: number[]) => request('todo/star', 'post', data)

// 更新 todo
export const updateTodoApi = (data: any) => request('/todo', 'put', data)

// 移动到其他分组
export const moveToGroupApi = (data: number[]) => request('/todo/move', 'post', data)

// 删除 todo
export const deleteTodoApi = (todoId: number) => request(`todo/${todoId}`, 'delete')

// 新建 todo
export const addTodoApi = (data: any) => request('/todo', 'post', data)

// 按关键字搜索 todo
export const searchTodo = (data: string) => request(`/todo/search/${data}`, 'get')
